package com.memo;

import java.util.Iterator;
import java.util.List;

import android.app.ListActivity;
import android.os.Bundle;
import android.util.Log;

import com.memo.controller.PickDayListAdapter;
import com.memo.model.Congratulation;
import com.memo.model.ListItemPickDay;

public class PickDayActivity extends ListActivity{
	private ListItemPickDay[] listItems;
	private static final String TAG = "PickDayActivity";
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.pick_day_list);
		App app = (App) this.getApplication();
		List<Congratulation> congs = app.getCongs();
		if (congs.size() == 0){
			Log.e(TAG, "=== NO GREATINGS TODAY ====");
		}else{
			listItems = new ListItemPickDay[congs.size()];
			Iterator<Congratulation> iter = congs.iterator();
			for(int i=0; iter.hasNext()&&(i<congs.size()); i++){
				listItems[i] = new ListItemPickDay(congs.get(i).getName(), congs.get(i).getCongrWay(), congs.get(i).getDate(), R.drawable.icon, true);
			}
			setListAdapter(new PickDayListAdapter(this, listItems));
		}
	}
	
}
